/**
 * @(#)XMLReader.java, 2008-4-30.
 * Copyright 2008  Program Analysis Research Group(PARG),Institute of Software, Peking University.
 * All rights reserved.
 */
package edu.pku.sei.pgie.persistence.xml;

import java.io.File;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;

/**
 * @author HeLi
 */
public class XMLReader {
    String path;

    public XMLReader(String path) {
        this.path = path;
    }

    public Element getRootElement() {
        SAXBuilder builder = new SAXBuilder();
        Document doc = null;
        try {
            doc = builder.build(new File(path));
            return doc.getRootElement();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
